package com.xshang.SqlSession;

import com.xshang.executor.SimpleExecutor;
import com.xshang.pojo.Configuration;

public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public SqlSession openSession() {
        // 创建执行器对象
        SimpleExecutor simpleExecutor = new SimpleExecutor();

        // 生产sqlSession 对象
        return new DefaultSqlSession(configuration,simpleExecutor);
    }
}
